﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Collections.Generic;
using DataAccess;

namespace QuanLyKhachSan
{
    public partial class XtraReportNhanVien : DevExpress.XtraReports.UI.XtraReport
    {
        private NhanVienManager controller = new NhanVienManager();
        private List<NhanVien> list = new List<NhanVien>();

        public XtraReportNhanVien(List<NhanVien> lis)
        {
            InitializeComponent();
            list = lis;
            Form_Load();
        }

        private void Form_Load()
        {
            
            foreach (var nv in list)
            {
                XRTableCell cell1 = new XRTableCell();
                XRTableCell cell2 = new XRTableCell();
                XRTableCell cell3 = new XRTableCell();
                XRTableCell cell4 = new XRTableCell();
                XRTableCell cell5 = new XRTableCell();
                XRTableCell cell6 = new XRTableCell();

                cell1.WidthF = 130;
                cell2.WidthF = 65;
                cell3.WidthF = 80;
                cell4.WidthF = 150;
                cell5.WidthF = 100;
                cell6.WidthF = 125;
 
                cell1.Text = nv.TenNhanVien;
                cell2.Text = nv.GioiTinh.Value?"Nam":"Nu";
                cell3.Text = nv.SCMND;
                cell4.Text = nv.DiaChi;
                cell5.Text = nv.NgayLamViec.ToShortDateString();
                cell6.Text = nv.Chucvu.TenCV;

                XRTableRow row = new XRTableRow();

                row.Cells.Add(cell1);
                row.Cells.Add(cell2);
                row.Cells.Add(cell3);
                row.Cells.Add(cell4);
                row.Cells.Add(cell5);
                row.Cells.Add(cell6);

                xrTable2.Rows.Add(row);
            }
            xrTable2.Rows[0].Visible = false;
        }
    }
}
